package com.jgit;

import java.io.IOException;

/**
 * Blob对象：存储文件内容
 */
public class Blob extends GitObject {
    private byte[] data;
    
    public Blob(byte[] data) {
        this.data = data;
    }
    
    public static Blob fromContent(byte[] content) {
        return new Blob(content);
    }
    
    @Override
    public String getType() {
        return "blob";
    }
    
    @Override
    public byte[] getRawContent() throws IOException {
        return data;
    }
    
    public byte[] getData() {
        return data;
    }
    
    public String getDataAsString() {
        return new String(data);
    }
}

